// pages/sh_tz_de/sh_tz_de.js
//shouquan.js
//获取应用实例
const app = getApp()

Page({
  data: {
    pageurl: '',
    isReport: true
  },
  onLoad: function (options) {
    var that = this;
    wx.request({
      url: 'https://wxapp.shuhai.cc/hh/findResult.action',
      method: 'post',
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      data: {
        openid: wx.getStorageSync("userOpenid"),
      },
      success: function (res) {
        console.log(res.data.data.shuhai_party_id)
        console.log(res.data.data.shuhai_userName);
        wx.setStorageSync("shuhai_party_id", res.data.data.shuhai_party_id);
        wx.setStorageSync("shuhai_jtid", res.data.data.shuhai_jtid);
        //判断集团的权限
        if (res.data.data.shuhai_userName == "贾新田" || res.data.data.shuhai_userName == "胡彦威" || res.data.data.shuhai_userName == "李文芳" || res.data.data.shuhai_userName == "荆作栋" || res.data.data.shuhai_userName == "吕建新" || res.data.data.shuhai_userName == "赵东军" || res.data.data.shuhai_userName == "雷俊林" || res.data.data.shuhai_userName == "范舒阳" || res.data.data.shuhai_userName == "张帆" || res.data.data.shuhai_userName == "李飞" || res.data.data.shuhai_userName == "康宏" || res.data.data.shuhai_userName == "杨兆刚" || res.data.data.shuhai_userName == "崔建聪" || res.data.data.shuhai_userName == "路建宏" || res.data.data.shuhai_userName == "邢海民" || res.data.data.shuhai_userName == "王珂" || res.data.data.shuhai_userName == "唐锋" || res.data.data.shuhai_userName == "郭文礼" || res.data.data.shuhai_userName == "樊有忠" || res.data.data.shuhai_userName == "智明" || res.data.data.shuhai_userName == "范勇" || res.data.data.shuhai_userName == "高红萍" || res.data.data.shuhai_userName == "胡景明" || res.data.data.shuhai_userName == "郭跃军" || res.data.data.shuhai_userName == "裴建平" || res.data.data.shuhai_userName == "赵玉" || res.data.data.shuhai_userName == "孙志勇" || res.data.data.shuhai_userName == "原琳" || res.data.data.shuhai_userName == "李勇") {
          that.setData({
            pageurl: 'https://wxapp.shuhai.cc/hh/baogao/view17.html'
          })//判断其他成员
        } else if (res.data.data.shuhai_userName == "姚军") {
          that.setData({
            pageurl: 'https://wxapp.shuhai.cc/hh/baogao/view1.html'
          })
        } else if (res.data.data.shuhai_userName == "续小强") {
          that.setData({
            pageurl: 'https://wxapp.shuhai.cc/hh/baogao/view2.html'
          })
        } else if (res.data.data.shuhai_userName == "张宝东") {
          that.setData({
            pageurl: 'https://wxapp.shuhai.cc/hh/baogao/view3.html'
          })
        } else if (res.data.data.shuhai_userName == "孟绍勇") {          
          that.setData({
            pageurl: 'https://wxapp.shuhai.cc/hh/baogao/view4.html'
          })
        } else if (res.data.data.shuhai_userName == "刘立平") {
          that.setData({
            pageurl: 'https://wxapp.shuhai.cc/hh/baogao/view5.html'
          })
        } else if (res.data.data.shuhai_userName == "赵建伟") {
          that.setData({
            pageurl: 'https://wxapp.shuhai.cc/hh/baogao/view6.html'
          })
        } else if (res.data.data.shuhai_userName == "张慧君") {
          that.setData({
            pageurl: 'https://wxapp.shuhai.cc/hh/baogao/view7.html'
          })
        } else if (res.data.data.shuhai_userName == "阎文凯") {
          that.setData({
            pageurl: 'https://wxapp.shuhai.cc/hh/baogao/view8.html'
          })
        } else if (res.data.data.shuhai_userName == "杨明波") {
          that.setData({
            pageurl: 'https://wxapp.shuhai.cc/hh/baogao/view9.html'
          })
        } else if (res.data.data.shuhai_userName == "杨志刚") {
          that.setData({
            pageurl: 'https://wxapp.shuhai.cc/hh/baogao/view10.html'
          })
        } else if (res.data.data.shuhai_userName == "张隆光") {
          that.setData({
            pageurl: 'https://wxapp.shuhai.cc/hh/baogao/view11.html'
          })
        } else if (res.data.data.shuhai_userName == "李岩") {
          that.setData({
            pageurl: 'https://wxapp.shuhai.cc/hh/baogao/view12.html'
          })
        } else if (res.data.data.shuhai_userName == "王跃东") {
          that.setData({
            pageurl: 'https://wxapp.shuhai.cc/hh/baogao/view13.html'
          })
        } else if (res.data.data.shuhai_userName == "赵学文") {
          that.setData({
            pageurl: 'https://wxapp.shuhai.cc/hh/baogao/view14.html'
          })
        } else if (res.data.data.shuhai_userName == "杨棣华") {
          that.setData({
            pageurl: 'https://wxapp.shuhai.cc/hh/baogao/view15.html'
          })
        } else if (res.data.data.shuhai_userName == "刘兴太") {
          that.setData({
            pageurl: 'https://wxapp.shuhai.cc/hh/baogao/view16.html'
          })
        } 
      }, fail: function (res) {
        wx.hideLoading();
        wx.showToast({
          title: '网络错误！',
          icon: 'none',
          duration: 2000
        })
        return;
      }
    });
  }
})
